package com.twu.biblioteca;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by pchavez on 07/02/14.
 */
public class User {
    private String name;
    private String email;
    private String phoneNumber;
    private String userId;
    private String password;
    private List<Borrowable> checkedOutBorrowables;

    public User(String name, String email, String phoneNumber, String userId, String password) {
        this.name = name;
        this.email = email;
        this.phoneNumber = phoneNumber;
        this.userId = userId;
        this.password = password;
        this.checkedOutBorrowables = new ArrayList<Borrowable>();
    }

    public String getInformation() {
        return name + ", " + email + ", " + phoneNumber;
    }

    public boolean isValid(String userID, String password) {
        return userID.equals(this.userId) && password.equals(this.password);
    }

    public List<Borrowable> getCheckedOutBorrowables() {
        return checkedOutBorrowables;
    }

    public void addBorrowable(Borrowable borrowable) {
        checkedOutBorrowables.add(borrowable);
    }

    public void removeBorrowable(Borrowable borrowable) {
        checkedOutBorrowables.remove(borrowable);
    }
}
